package com.yiyoucheng.service.impl;

import com.yiyoucheng.mapper.DepartmentMapper;
import com.yiyoucheng.pojo.Department;
import com.yiyoucheng.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//部门服务实现类
@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    //查询所有部门
    @Override
    public List<Department> findAll() {
        return departmentMapper.findAll();
    }

    //根据父id查询部门信息
    @Override
    public List<Department> findByPid(int pid) {
        return departmentMapper.findByPid(pid);
    }

    //根据部门id查询层级关系level
    @Override
    public String findLevel(int id) {
        return departmentMapper.findLevel(id);
    }
}
